package com.lidong.lowcode.model.database.model;

import com.lidong.lowcode.model.service.ModelTableService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @author LiDong
 * @version 1.0.0
 * @createTime 5/4/2022 12:23 PM
 */
@Component
@Order(1)
public class ModelRunner implements CommandLineRunner {

    private static final Logger logger = LoggerFactory.getLogger(ModelRunner.class);

    @Autowired(required = false)
    private ModelTableService modelTableService;


    @Override
    public void run(String... args) throws Exception {
        // 创建 datasource 表
        modelTableService.createDataSourceTable();
        logger.info("建表：" + "b_datasource");
    }
}
